<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>事件冒泡</title>
    <script>
        function clickDiv(){
            // alert("正在点击div")
            location.href = "19-菜单的隐藏与显示.html";
        }

        function clickA(){
            // alert("正在点击超链接")
            document.getElementById("d").style.display = "none";
            // console.log(event);
            event.cancelBubble = true;
        }
    </script>
</head>
<body>
<div id="d" style="width: 200px;height: 100px;background-color: red;display: block;" onclick="clickDiv()">
    <a href="javascript:;" onclick="clickA()">X</a>
</div>
</body>
</html>